{% extends "partials/base.html" %}
{% block title %}Failed files{% endblock %}
{% set active_page = "failed" %}
{% block content %}
    <div class="row mb-1">
        <h5 class="card-title col">Unmatched Files</h5>
        <div class="col">
            <button id="refreshFiles" type="button" class="btn btn-secondary float-end ms-1" data-target="files" title="Refresh">
                <i class="bi bi-arrow-clockwise"></i>
            </button>
            <div id="tableButtons" class="float-end ms-1"></div>
        </div>
    </div>
    <div class="card-text">
        <div id="filesResult">
            {% include 'render/failedFiles.html' %}
        </div>
    </div>
{% endblock %}
{% block external %}
    {% if config.write_namer_failed_log %}
        <div id="logFile" class="modal fade" tabindex="-1" aria-labelledby="modalLogsLabel" aria-hidden="true">
            <div class="modal-dialog modal-xl modal-fullscreen-lg-down modal-dialog-scrollable">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 id="modalLogsLabel" class="modal-title text-truncate">Failed Log <span></span></h5>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <div class="progress"></div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </div>
    {% endif %}
    <div id="searchForm" class="modal fade" tabindex="-1" aria-labelledby="searchFormLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 id="searchFormLabel" class="modal-title">Search</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="form-floating mb-3">
                        <input id="queryInput" type="text" class="form-control">
                        <label for="queryInput">Search query</label>
                    </div>
                    <div class="form-floating">
                        <select id="queryType" class="form-select" aria-label="Search type">
                            <option selected>Any</option>
                            <option>Scenes</option>
                            <option>Movies</option>
                            <option>JAV</option>
                        </select>
                        <label for="queryType">Search type</label>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary search" data-bs-target="#searchResults" data-bs-toggle="modal" data-bs-dismiss="modal">
                        Submit
                    </button>
                    <button type="button" class="btn btn-danger phash" data-bs-target="#searchResults" data-bs-toggle="modal" data-bs-dismiss="modal">
                        PHash
                    </button>
                </div>
            </div>
        </div>
    </div>
    <div id="searchResults" class="modal fade" tabindex="-1" aria-labelledby="modalSearchResultsLabel" aria-hidden="true">
        <div class="modal-dialog modal-xl modal-fullscreen-lg-down modal-dialog-scrollable">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 id="modalSearchResultsLabel" class="modal-title text-truncate">Search Result <span></span></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="progress"></div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-target="#searchForm" data-bs-toggle="modal" data-bs-dismiss="modal">Back</button>
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>
    {% if config.allow_delete_files %}
        <div id="deleteConfirm" class="modal fade" tabindex="-1" aria-labelledby="modalDeleteConfirmLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 id="modalDeleteConfirmLabel" class="modal-title">Confirmation</h5>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <p>Are you sure you wanted to delete this file?</p>
                        <div class="form-floating">
                            <input id="deleteFile" type="text" class="form-control" disabled>
                            <label for="deleteFile">File</label>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                        <button id="deleteButton" type="button" class="btn btn-danger" data-bs-dismiss="modal">Yes
                        </button>
                    </div>
                </div>
            </div>
        </div>
    {% endif %}
{% endblock %}
